Core Data iPhone how often should I call [managedObjectContext save:&error] when doing 50k record in
Posted
by jamone
on Stack Overflow
See other posts from Stack Overflow
or by jamone
Published on 2010-04-19T01:20:23Z
Indexed on
2010/04/19
1:23 UTC
Read the original article
Hit count: 555
I will be doing an occiasional import from XML into core data. I have around 50k entities that will be added. My question is how often should I call [managedObjectContext save:&error]. For every new entity added, or every x entities, or just at the end of the 50k import?
I currently am calling it for each entity and tried only doing it for around every 10k and import speed went up drastically but after the first 30k it would crash with:
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <NSCFSet: 0x13e760> was mutated while being enumerated.'
Before I spend too much time trying to diagnose what is going on there I figured I'd check if its ok to not call save on every entity?
Is the # of entities before calling save limited by the amount of memory those entities are using?
© Stack Overflow or respective owner